package com.cooper.mediadb.local;

import android.support.v4.app.FragmentManager;

import com.cooper.mediadb.MediaBrowseBaseFragment;
import com.cooper.scraper.show.FanartViewStrategy;

public abstract class LocalMediaFragment<T extends LocalMedia> extends
		MediaBrowseBaseFragment<T> {

	@Override
	public void onFullWatingCanceled() {
	}

	private LocalFanartViewStrategy<T> viewStrategy = null;
	
	@Override
	protected FanartViewStrategy<T> getViewStrategy(){
		if (viewStrategy == null){
			viewStrategy = new LocalFanartViewStrategy<T>(getActivity().getApplicationContext());
		}
		//this.onDestroyView()
		return viewStrategy;
	}
	
	@Override 
	public void onDestroyView(){
		super.onDestroyView();
		if (viewStrategy != null){
			viewStrategy.destroy();
			viewStrategy = null;
		}
	}
	
	@Override
	protected void showMediaDetails(T media){
		currentMedia = media;
		
		LocalMediaInfoDialog<T> mediaInfoDialog = new LocalMediaInfoDialog<T>() ;
		FragmentManager fm = getActivity().getSupportFragmentManager();
		mediaInfoDialog.show(fm, "MEDIA_INFO_DIALOG");
	}
	


}
